package com.m3958.firstgwt.server.workflowy;

import java.net.UnknownHostException;

import com.google.inject.Singleton;
import com.mongodb.DB;
import com.mongodb.Mongo;
import com.mongodb.MongoException;
/*
 * {"userId":123,"name":"","note":"","ancestors":[],"path":",,,"}
 */

@Singleton
public class WorkFlowMongoDbService {
	
	private DB workflowDb;
	
	
	private static String DB_NAME = "workflowDb";
	
	public WorkFlowMongoDbService(){
		Mongo m;
		try {
			m = new Mongo("127.0.0.1" , 27017 );
			setWorkflowDb(m.getDB( DB_NAME ));
		} catch (UnknownHostException e) {
			e.printStackTrace();
		} catch (MongoException e) {
			e.printStackTrace();
		}
		
	}

	public void setWorkflowDb(DB workflowDb) {
		this.workflowDb = workflowDb;
	}

	public DB getWorkflowDb() {
		return workflowDb;
	}



}
